#-*- codeing = utf-8 -*-
#@Time : 2020/10/20 22:38
#@Author : 阳某
#@File : Python处理Excel一列变多列.py
#@Software : PyCharm

import pandas as pd
df = pd.read_excel("./course_datas/c42_split_onecolumn_tomany/学生数据表.xlsx")
print(df.head())
# 2. 实现拆分
def split_func(line):
    line["姓名"], line["性别"], line["年龄"], line["城市"] = line["数据"].split(":")
    return line

df = df.apply(split_func, axis=1)
print(df.head())
print(df.drop(["数据"], axis=1, inplace=True))
# 3. 输出到结果Excel
# df.to_excel